From e49005b2b4cef3f1363ba12c6ed928162527249f Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Tue, 9 Feb 2021 19:41:06 +0000 Subject: [PATCH] Import abseil_0~20200923.3-2.debian.tar.xz [dgit import tarball abseil 0~20200923.3-2 abseil_0~20200923.3-2.debian.tar.xz] --- README.Debian | 9 + changelog | 81 +++++++++ control | 56 +++++++ copyright | 35 ++++ gbp.conf | 16 ++ libabsl-dev.install | 18 ++ libabsl20200923.install | 74 +++++++++ libabsl20200923.lintian-overrides | 17 ++ libabsl20200923.shlibs | 74 +++++++++ patches/configure.diff | 115 +++++++++++++ patches/cpu-frequency.diff | 54 ++++++ patches/endian-hash.diff | 111 +++++++++++++ patches/endian-random.diff | 249 +++++++++++++++++++++++++++ patches/fix-hppa.diff | 26 +++ patches/latomic.diff | 20 +++ patches/nan-narrowing.diff | 25 +++ patches/ppc-float-conversion.diff | 268 ++++++++++++++++++++++++++++++ patches/series | 9 + patches/std-hash.diff | 46 +++++ rules | 52 ++++++ source/format | 1 + tests/cmake | 45 +++++ tests/control | 19 +++ tests/smoke | 37 +++++ watch | 17 ++ 25 files changed, 1474 insertions(+) create mode 100644 README.Debian create mode 100644 changelog create mode 100644 control create mode 100644 copyright create mode 100644 gbp.conf create mode 100644 libabsl-dev.install create mode 100644 libabsl20200923.install create mode 100644 libabsl20200923.lintian-overrides create mode 100644 libabsl20200923.shlibs create mode 100644 patches/configure.diff create mode 100644 patches/cpu-frequency.diff create mode 100644 patches/endian-hash.diff create mode 100644 patches/endian-random.diff create mode 100644 patches/fix-hppa.diff create mode 100644 patches/latomic.diff create mode 100644 patches/nan-narrowing.diff create mode 100644 patches/ppc-float-conversion.diff create mode 100644 patches/series create mode 100644 patches/std-hash.diff create mode 100755 rules create mode 100644 source/format create mode 100755 tests/cmake create mode 100644 tests/control create mode 100755 tests/smoke create mode 100644 watch diff --git a/README.Debian b/README.Debian new file mode 100644 index 0000000..7c0dd3c --- /dev/null +++ b/README.Debian @@ -0,0 +1,9 @@ +Abseil for Debian +----------------- + +libabsl-dev installs a number of files to 'internal' directories. In general, +your project should not directly include any files from these directories; they +may change without warning. If you think you need something from one of those +files, please report a bug with reportbug(1). + + -- Benjamin Barenblat Thu, 07 May 2020 11:35:28 -0400 diff --git a/changelog b/changelog new file mode 100644 index 0000000..ce59cc1 --- /dev/null +++ b/changelog @@ -0,0 +1,81 @@ +abseil (0~20200923.3-2) unstable; urgency=medium + + * Correct string formatting on POWER. + + -- Benjamin Barenblat Tue, 09 Feb 2021 14:41:06 -0500 + +abseil (0~20200923.3-1) unstable; urgency=medium + + * New upstream release. + * Correct endianness issues in hash functions and RNG. + + -- Benjamin Barenblat Mon, 08 Feb 2021 15:04:52 -0500 + +abseil (0~20200923.2-3) unstable; urgency=medium + + * Fix some issues in unit tests. + * Re-disable unit tests on most platforms until they’re working + everywhere. + + -- Benjamin Barenblat Sun, 31 Jan 2021 15:13:51 -0500 + +abseil (0~20200923.2-2) unstable; urgency=medium + + * Reenable unit tests. + + -- Benjamin Barenblat Tue, 01 Dec 2020 12:37:56 -0500 + +abseil (0~20200923.2-1) unstable; urgency=medium + + * New upstream release. + * Fix build on hppa via patch. (Closes: #971768) + * Link libatomic where necessary to prevent issues with load-time + symbol resolution. (Closes: #973492) + + -- Benjamin Barenblat Fri, 06 Nov 2020 16:51:39 -0500 + +abseil (0~20200923.1-1) unstable; urgency=medium + + * New upstream release. + + -- Benjamin Barenblat Mon, 12 Oct 2020 12:40:50 -0400 + +abseil (0~20200923-2) unstable; urgency=medium + + * Release for unstable. + + -- Benjamin Barenblat Tue, 06 Oct 2020 10:00:02 -0400 + +abseil (0~20200923-1) experimental; urgency=medium + + * New upstream release. + + -- Benjamin Barenblat Fri, 25 Sep 2020 17:57:31 -0400 + +abseil (0~20200225.2-4) unstable; urgency=medium + + * Fix "autopkgtest needs update for new version of cmake: warning on + stderr" by applying a patch from upstream. (Closes: #970333) + + -- Benjamin Barenblat Mon, 14 Sep 2020 17:40:05 -0400 + +abseil (0~20200225.2-3) unstable; urgency=medium + + * Replace symbols file with shlibs infrastructure. (Closes: #966183) + + -- Benjamin Barenblat Fri, 24 Jul 2020 09:42:03 -0400 + +abseil (0~20200225.2-2) unstable; urgency=medium + + * Rebuild for unstable. + * Rework symbols file using pkg-kde-tools for increased robustness. + * Avoid SSSE3 on amd64 and SSE2 on i386 for greater processor + compatibility. + + -- Benjamin Barenblat Thu, 23 Jul 2020 17:23:57 -0400 + +abseil (0~20200225.2-1) experimental; urgency=medium + + * Initial release. (Closes: #888705) + + -- Benjamin Barenblat Thu, 18 Jun 2020 16:27:49 -0400 diff --git a/control b/control new file mode 100644 index 0000000..7ebf70d --- /dev/null +++ b/control @@ -0,0 +1,56 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +Source: abseil +Priority: optional +Maintainer: Benjamin Barenblat +Build-Depends: + cmake (>= 3.5), + debhelper-compat (= 12), + googletest (>= 1.10.0.20200926) [amd64], +Rules-Requires-Root: no +Standards-Version: 4.5.1 +Section: libs +Homepage: https://abseil.io/ +Vcs-Browser: https://salsa.debian.org/debian/abseil +Vcs-Git: https://salsa.debian.org/debian/abseil.git +Description: extensions to the C++ standard library + Abseil is an open-source collection of C++ library code designed to augment the + C++ standard library. The Abseil library code is collected from Google's C++ + codebase and has been extensively tested and used in production. In some cases, + Abseil provides pieces missing from the C++ standard; in others, Abseil + provides alternatives to the standard for special needs. + +Package: libabsl-dev +Architecture: any +Multi-Arch: same +Section: libdevel +Depends: + libabsl20200923 (= ${binary:Version}), + ${misc:Depends}, +Recommends: cmake (>= 2.6), g++ (>= 4.7) +Description: ${source:Synopsis} (development files) + ${source:Extended-Description} + . + This package contains header files and other data necessary for developing with + Abseil. + +Package: libabsl20200923 +Architecture: any +Multi-Arch: same +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: ${source:Synopsis} + ${source:Extended-Description} + . + This package contains Abseil's shared libraries. diff --git a/copyright b/copyright new file mode 100644 index 0000000..78336c1 --- /dev/null +++ b/copyright @@ -0,0 +1,35 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Abseil +Upstream-Contact: abseil-io@googlegroups.com +Source: https://github.com/abseil/abseil-cpp/ +Copyright: 2017 The Abseil Authors +License: Apache-2.0 + +Files: * +Copyright: + 2000-2017 Google Inc. + 2017-2020 The Abseil Authors +License: Apache-2.0 + +Files: debian/* +Copyright: 2020 Google LLC +License: Apache-2.0 + +Files: debian/patches/fix-hppa.diff +Copyright: 2020 John David Anglin +License: Apache-2.0 + +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at + . + https://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software distributed + under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for the + specific language governing permissions and limitations under the License. + . + On Debian systems, the complete text of the Apache License, Version 2.0, can be + found in "/usr/share/common-licenses/Apache-2.0". diff --git a/gbp.conf b/gbp.conf new file mode 100644 index 0000000..c24fe09 --- /dev/null +++ b/gbp.conf @@ -0,0 +1,16 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +[DEFAULT] +upstream-tag = 20200923.3 diff --git a/libabsl-dev.install b/libabsl-dev.install new file mode 100644 index 0000000..db5108c --- /dev/null +++ b/libabsl-dev.install @@ -0,0 +1,18 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +usr/include/absl +usr/lib/*/*.a +usr/lib/*/*.so +usr/lib/*/cmake diff --git a/libabsl20200923.install b/libabsl20200923.install new file mode 100644 index 0000000..e5967b9 --- /dev/null +++ b/libabsl20200923.install @@ -0,0 +1,74 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +usr/lib/*/libabsl_bad_any_cast_impl.so.* +usr/lib/*/libabsl_bad_optional_access.so.* +usr/lib/*/libabsl_bad_variant_access.so.* +usr/lib/*/libabsl_base.so.* +usr/lib/*/libabsl_city.so.* +usr/lib/*/libabsl_civil_time.so.* +usr/lib/*/libabsl_cord.so.* +usr/lib/*/libabsl_debugging_internal.so.* +usr/lib/*/libabsl_demangle_internal.so.* +usr/lib/*/libabsl_examine_stack.so.* +usr/lib/*/libabsl_exponential_biased.so.* +usr/lib/*/libabsl_failure_signal_handler.so.* +usr/lib/*/libabsl_flags.so.* +usr/lib/*/libabsl_flags_commandlineflag.so.* +usr/lib/*/libabsl_flags_commandlineflag_internal.so.* +usr/lib/*/libabsl_flags_config.so.* +usr/lib/*/libabsl_flags_internal.so.* +usr/lib/*/libabsl_flags_marshalling.so.* +usr/lib/*/libabsl_flags_parse.so.* +usr/lib/*/libabsl_flags_private_handle_accessor.so.* +usr/lib/*/libabsl_flags_program_name.so.* +usr/lib/*/libabsl_flags_reflection.so.* +usr/lib/*/libabsl_flags_usage.so.* +usr/lib/*/libabsl_flags_usage_internal.so.* +usr/lib/*/libabsl_graphcycles_internal.so.* +usr/lib/*/libabsl_hash.so.* +usr/lib/*/libabsl_hashtablez_sampler.so.* +usr/lib/*/libabsl_int128.so.* +usr/lib/*/libabsl_leak_check.so.* +usr/lib/*/libabsl_leak_check_disable.so.* +usr/lib/*/libabsl_log_severity.so.* +usr/lib/*/libabsl_malloc_internal.so.* +usr/lib/*/libabsl_periodic_sampler.so.* +usr/lib/*/libabsl_random_distributions.so.* +usr/lib/*/libabsl_random_internal_distribution_test_util.so.* +usr/lib/*/libabsl_random_internal_platform.so.* +usr/lib/*/libabsl_random_internal_pool_urbg.so.* +usr/lib/*/libabsl_random_internal_randen.so.* +usr/lib/*/libabsl_random_internal_randen_hwaes.so.* +usr/lib/*/libabsl_random_internal_randen_hwaes_impl.so.* +usr/lib/*/libabsl_random_internal_randen_slow.so.* +usr/lib/*/libabsl_random_internal_seed_material.so.* +usr/lib/*/libabsl_random_seed_gen_exception.so.* +usr/lib/*/libabsl_random_seed_sequences.so.* +usr/lib/*/libabsl_raw_hash_set.so.* +usr/lib/*/libabsl_raw_logging_internal.so.* +usr/lib/*/libabsl_scoped_set_env.so.* +usr/lib/*/libabsl_spinlock_wait.so.* +usr/lib/*/libabsl_stacktrace.so.* +usr/lib/*/libabsl_status.so.* +usr/lib/*/libabsl_statusor.so.* +usr/lib/*/libabsl_str_format_internal.so.* +usr/lib/*/libabsl_strerror.so.* +usr/lib/*/libabsl_strings.so.* +usr/lib/*/libabsl_strings_internal.so.* +usr/lib/*/libabsl_symbolize.so.* +usr/lib/*/libabsl_synchronization.so.* +usr/lib/*/libabsl_throw_delegate.so.* +usr/lib/*/libabsl_time.so.* +usr/lib/*/libabsl_time_zone.so.* diff --git a/libabsl20200923.lintian-overrides b/libabsl20200923.lintian-overrides new file mode 100644 index 0000000..1fed50f --- /dev/null +++ b/libabsl20200923.lintian-overrides @@ -0,0 +1,17 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +libabsl20200923: no-symbols-control-file usr/lib/*/libabsl_* +libabsl20200923: package-name-doesnt-match-sonames libabsl-* +libabsl20200923: spelling-error-in-binary usr/lib/*/libabsl_flags_usage_internal.so* helpfull helpful diff --git a/libabsl20200923.shlibs b/libabsl20200923.shlibs new file mode 100644 index 0000000..e84201f --- /dev/null +++ b/libabsl20200923.shlibs @@ -0,0 +1,74 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +# +libabsl_bad_any_cast_impl 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_bad_optional_access 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_bad_variant_access 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_base 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_city 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_civil_time 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_cord 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_debugging_internal 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_demangle_internal 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_examine_stack 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_exponential_biased 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_failure_signal_handler 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_flags 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_flags_commandlineflag 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_flags_commandlineflag_internal 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_flags_config 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_flags_internal 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_flags_marshalling 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_flags_parse 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_flags_private_handle_accessor 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_flags_program_name 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_flags_reflection 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_flags_usage 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_flags_usage_internal 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_graphcycles_internal 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_hash 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_hashtablez_sampler 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_int128 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_leak_check 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_leak_check_disable 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_log_severity 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_malloc_internal 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_periodic_sampler 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_random_distributions 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_random_internal_distribution_test_util 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_random_internal_platform 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_random_internal_pool_urbg 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_random_internal_randen 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_random_internal_randen_hwaes 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_random_internal_randen_hwaes_impl 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_random_internal_randen_slow 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_random_internal_seed_material 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_random_seed_gen_exception 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_random_seed_sequences 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_raw_hash_set 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_raw_logging_internal 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_scoped_set_env 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_spinlock_wait 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_stacktrace 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_status 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_statusor 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_str_format_internal 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_strerror 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_strings 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_strings_internal 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_symbolize 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_synchronization 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_throw_delegate 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_time 20200923 libabsl20200923 (>= 0~20200923-1) +libabsl_time_zone 20200923 libabsl20200923 (>= 0~20200923-1) diff --git a/patches/configure.diff b/patches/configure.diff new file mode 100644 index 0000000..5c47b15 --- /dev/null +++ b/patches/configure.diff @@ -0,0 +1,115 @@ +From: Benjamin Barenblat +Subject: Set package configuration options +Forwarded: not-needed + +Configure Abseil for Debian. + + - Set the SONAME appropriately. + + - To minimize the possibility of future ABI breakage, treat absl::any, + absl::optional, absl::string_view, and absl::variant as their own types + (rather than aliases for the std:: versions), and compile everything in an + inline namespace. + + - Enable upstream's hardened build mode. + + - Disable Intel SSE2 on i386, since Debian supports some i386 processors + without that extension. Keep it enabled on amd64, since all amd64 processors + have it. + + - Disable Intel SSSE3 entirely, since no i386 processor supports it and Debian + supports amd64 processors without it. + +--- a/CMake/AbseilHelpers.cmake ++++ b/CMake/AbseilHelpers.cmake +@@ -217,6 +217,9 @@ + OUTPUT_NAME "absl_${_NAME}" + ) + endif() ++ ++ set_property(TARGET ${_NAME} PROPERTY SOVERSION 20200923) ++ set_property(TARGET ${_NAME} PROPERTY VERSION "20200923.0.1") + else() + # Generating header-only library + add_library(${_NAME} INTERFACE) +--- a/absl/base/options.h ++++ b/absl/base/options.h +@@ -100,7 +100,7 @@ + // User code should not inspect this macro. To check in the preprocessor if + // absl::any is a typedef of std::any, use the feature macro ABSL_USES_STD_ANY. + +-#define ABSL_OPTION_USE_STD_ANY 2 ++#define ABSL_OPTION_USE_STD_ANY 0 + + + // ABSL_OPTION_USE_STD_OPTIONAL +@@ -127,7 +127,7 @@ + // absl::optional is a typedef of std::optional, use the feature macro + // ABSL_USES_STD_OPTIONAL. + +-#define ABSL_OPTION_USE_STD_OPTIONAL 2 ++#define ABSL_OPTION_USE_STD_OPTIONAL 0 + + + // ABSL_OPTION_USE_STD_STRING_VIEW +@@ -154,7 +154,7 @@ + // absl::string_view is a typedef of std::string_view, use the feature macro + // ABSL_USES_STD_STRING_VIEW. + +-#define ABSL_OPTION_USE_STD_STRING_VIEW 2 ++#define ABSL_OPTION_USE_STD_STRING_VIEW 0 + + // ABSL_OPTION_USE_STD_VARIANT + // +@@ -180,7 +180,7 @@ + // absl::variant is a typedef of std::variant, use the feature macro + // ABSL_USES_STD_VARIANT. + +-#define ABSL_OPTION_USE_STD_VARIANT 2 ++#define ABSL_OPTION_USE_STD_VARIANT 0 + + + // ABSL_OPTION_USE_INLINE_NAMESPACE +@@ -206,7 +206,7 @@ + // allowed. + + #define ABSL_OPTION_USE_INLINE_NAMESPACE 1 +-#define ABSL_OPTION_INLINE_NAMESPACE_NAME lts_2020_09_23 ++#define ABSL_OPTION_INLINE_NAMESPACE_NAME debian1 + + // ABSL_OPTION_HARDENED + // +@@ -233,6 +233,6 @@ + // checks enabled by this option may abort the program in a different way and + // log additional information when `NDEBUG` is not defined. + +-#define ABSL_OPTION_HARDENED 0 ++#define ABSL_OPTION_HARDENED 1 + + #endif // ABSL_BASE_OPTIONS_H_ +--- a/absl/container/internal/have_sse.h ++++ b/absl/container/internal/have_sse.h +@@ -17,22 +17,14 @@ + #define ABSL_CONTAINER_INTERNAL_HAVE_SSE_H_ + + #ifndef ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2 +-#if defined(__SSE2__) || \ +- (defined(_MSC_VER) && \ +- (defined(_M_X64) || (defined(_M_IX86) && _M_IX86_FP >= 2))) ++#if defined(__x86_64__) || (defined(_MSC_VER) && defined(_M_X64)) + #define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2 1 + #else + #define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2 0 + #endif + #endif + +-#ifndef ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 +-#ifdef __SSSE3__ +-#define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 1 +-#else + #define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 0 +-#endif +-#endif + + #if ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 && \ + !ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2 diff --git a/patches/cpu-frequency.diff b/patches/cpu-frequency.diff new file mode 100644 index 0000000..adfba7e --- /dev/null +++ b/patches/cpu-frequency.diff @@ -0,0 +1,54 @@ +From: Benjamin Barenblat +Subject: Ignore missing CPU frequency on more architectures +Forwarded: yes +Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/1918ad2ae38aa32c74b558b322479a8efdd76363 + +Linux on MIPS, PA-RISC, RISC-V, and SystemZ doesn’t expose the nominal CPU +frequency via /sys, so don’t worry if `NominalCPUFrequency` returns 1.0 on those +platforms. + +Some POWER machines expose the CPU frequency; others do not. Since we can’t +predict which type of machine the tests will run on, simply disable testing for +`NominalCPUFrequency` on POWER. + +The author works at Google. Upstream applied this patch as Piper revision +347079873 and exported it to GitHub; the Applied-Upstream URL above points to +the exported commit. + +--- a/absl/base/internal/sysinfo_test.cc ++++ b/absl/base/internal/sysinfo_test.cc +@@ -37,17 +37,28 @@ TEST(SysinfoTest, NumCPUs) { + << "NumCPUs() should not have the default value of 0"; + } + ++// Ensure that NominalCPUFrequency returns a reasonable value, or 1.00 on ++// platforms where the CPU frequency is not available through sysfs. ++// ++// POWER is particularly problematic here; some Linux kernels expose the CPU ++// frequency, while others do not. Since we can't predict a priori what a given ++// machine is going to do, just disable this test on POWER on Linux. ++#if !(defined(__linux) && (defined(__ppc64__) || defined(__PPC64__))) + TEST(SysinfoTest, NominalCPUFrequency) { +-#if !(defined(__aarch64__) && defined(__linux__)) && !defined(__EMSCRIPTEN__) +- EXPECT_GE(NominalCPUFrequency(), 1000.0) +- << "NominalCPUFrequency() did not return a reasonable value"; +-#else +- // Aarch64 cannot read the CPU frequency from sysfs, so we get back 1.0. +- // Emscripten does not have a sysfs to read from at all. ++ // Linux only exposes the CPU frequency on certain architectures, and ++ // Emscripten doesn't expose it at all. ++#if defined(__linux__) && \ ++ (defined(__aarch64__) || defined(__hppa__) || defined(__mips__) || \ ++ defined(__riscv) || defined(__s390x__)) || \ ++ defined(__EMSCRIPTEN__) + EXPECT_EQ(NominalCPUFrequency(), 1.0) + << "CPU frequency detection was fixed! Please update unittest."; ++#else ++ EXPECT_GE(NominalCPUFrequency(), 1000.0) ++ << "NominalCPUFrequency() did not return a reasonable value"; + #endif + } ++#endif + + TEST(SysinfoTest, GetTID) { + EXPECT_EQ(GetTID(), GetTID()); // Basic compile and equality test. diff --git a/patches/endian-hash.diff b/patches/endian-hash.diff new file mode 100644 index 0000000..01c1b6b --- /dev/null +++ b/patches/endian-hash.diff @@ -0,0 +1,111 @@ +From: Benjamin Barenblat +Subject: Remove endian-sensitivity from hash slow path +Forwarded: yes +Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/9c6a50fdd80bb39fabd95faeda84f04062685ff3 + +Prior to this commit, the Abseil hash fast path was endian-agnostic, but +the slow path assumed a little-endian platform. Change the slow path to +be endian-correct, ensuring that values produced by the fast and slow +paths are equal even on big-endian systems. + +The author works at Google. Upstream applied this patch as Piper revision +355424258 and exported it to GitHub; the Applied-Upstream URL above points to +the exported commit. + +--- a/absl/hash/BUILD.bazel ++++ b/absl/hash/BUILD.bazel +@@ -37,6 +37,7 @@ cc_library(name = "hash", + linkopts = ABSL_DEFAULT_LINKOPTS, + deps = [ + ":city", ++ "//absl/base:config", + "//absl/base:core_headers", + "//absl/base:endian", + "//absl/container:fixed_array", +--- a/absl/hash/CMakeLists.txt ++++ b/absl/hash/CMakeLists.txt +@@ -25,6 +25,7 @@ absl_cc_library(NAME hash + COPTS + ${ABSL_DEFAULT_COPTS} + DEPS ++ absl::config + absl::core_headers + absl::endian + absl::fixed_array +--- a/absl/hash/internal/hash.h ++++ b/absl/hash/internal/hash.h +@@ -38,7 +38,8 @@ + #include + #include + +-#include "absl/base/internal/endian.h" ++#include "absl/base/config.h" ++#include "absl/base/internal/unaligned_access.h" + #include "absl/base/port.h" + #include "absl/container/fixed_array.h" + #include "absl/meta/type_traits.h" +@@ -804,26 +805,54 @@ class ABSL_DLL CityHashState + size_t len); + + // Reads 9 to 16 bytes from p. +- // The first 8 bytes are in .first, the rest (zero padded) bytes are in +- // .second. ++ // The least significant 8 bytes are in .first, the rest (zero padded) bytes ++ // are in .second. + static std::pair Read9To16(const unsigned char* p, + size_t len) { +- uint64_t high = little_endian::Load64(p + len - 8); +- return {little_endian::Load64(p), high >> (128 - len * 8)}; ++ uint64_t low_mem = absl::base_internal::UnalignedLoad64(p); ++ uint64_t high_mem = absl::base_internal::UnalignedLoad64(p + len - 8); ++#ifdef ABSL_IS_LITTLE_ENDIAN ++ uint64_t most_significant = high_mem; ++ uint64_t least_significant = low_mem; ++#else ++ uint64_t most_significant = low_mem; ++ uint64_t least_significant = high_mem; ++#endif ++ return {least_significant, most_significant >> (128 - len * 8)}; + } + + // Reads 4 to 8 bytes from p. Zero pads to fill uint64_t. + static uint64_t Read4To8(const unsigned char* p, size_t len) { +- return (static_cast(little_endian::Load32(p + len - 4)) +- << (len - 4) * 8) | +- little_endian::Load32(p); ++ uint32_t low_mem = absl::base_internal::UnalignedLoad32(p); ++ uint32_t high_mem = absl::base_internal::UnalignedLoad32(p + len - 4); ++#ifdef ABSL_IS_LITTLE_ENDIAN ++ uint32_t most_significant = high_mem; ++ uint32_t least_significant = low_mem; ++#else ++ uint32_t most_significant = low_mem; ++ uint32_t least_significant = high_mem; ++#endif ++ return (static_cast(most_significant) << (len - 4) * 8) | ++ least_significant; + } + + // Reads 1 to 3 bytes from p. Zero pads to fill uint32_t. + static uint32_t Read1To3(const unsigned char* p, size_t len) { +- return static_cast((p[0]) | // +- (p[len / 2] << (len / 2 * 8)) | // +- (p[len - 1] << ((len - 1) * 8))); ++ unsigned char mem0 = p[0]; ++ unsigned char mem1 = p[len / 2]; ++ unsigned char mem2 = p[len - 1]; ++#ifdef ABSL_IS_LITTLE_ENDIAN ++ unsigned char significant2 = mem2; ++ unsigned char significant1 = mem1; ++ unsigned char significant0 = mem0; ++#else ++ unsigned char significant2 = mem0; ++ unsigned char significant1 = mem1; ++ unsigned char significant0 = mem2; ++#endif ++ return static_cast(significant0 | // ++ (significant1 << (len / 2 * 8)) | // ++ (significant2 << ((len - 1) * 8))); + } + + ABSL_ATTRIBUTE_ALWAYS_INLINE static uint64_t Mix(uint64_t state, uint64_t v) { diff --git a/patches/endian-random.diff b/patches/endian-random.diff new file mode 100644 index 0000000..9fe2b16 --- /dev/null +++ b/patches/endian-random.diff @@ -0,0 +1,249 @@ +From: Benjamin Barenblat +Subject: Remove endian-sensitivity from Abseil's RNG +Forwarded: yes +Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/c36d825d9a5443f81d2656685ae021d6326da90c + +Ensure that the Abseil random number generator produces identical output +on both big- and little-endian platforms by byte-swapping appropriately +on big-endian systems. + +The author works at Google. Upstream applied this patch as Piper +revision 355635051 and exported it to GitHub; the Applied-Upstream URL +above points to the exported commit. + +--- a/absl/base/BUILD.bazel ++++ b/absl/base/BUILD.bazel +@@ -479,6 +479,7 @@ + copts = ABSL_DEFAULT_COPTS, + linkopts = ABSL_DEFAULT_LINKOPTS, + deps = [ ++ ":base", + ":config", + ":core_headers", + ], +--- a/absl/base/CMakeLists.txt ++++ b/absl/base/CMakeLists.txt +@@ -418,6 +418,7 @@ + COPTS + ${ABSL_DEFAULT_COPTS} + DEPS ++ absl::base + absl::config + absl::core_headers + PUBLIC +--- a/absl/base/internal/endian.h ++++ b/absl/base/internal/endian.h +@@ -26,6 +26,7 @@ + #endif + + #include ++#include "absl/base/casts.h" + #include "absl/base/config.h" + #include "absl/base/internal/unaligned_access.h" + #include "absl/base/port.h" +@@ -173,6 +174,36 @@ + + #endif /* ENDIAN */ + ++inline uint8_t FromHost(uint8_t x) { return x; } ++inline uint16_t FromHost(uint16_t x) { return FromHost16(x); } ++inline uint32_t FromHost(uint32_t x) { return FromHost32(x); } ++inline uint64_t FromHost(uint64_t x) { return FromHost64(x); } ++inline uint8_t ToHost(uint8_t x) { return x; } ++inline uint16_t ToHost(uint16_t x) { return ToHost16(x); } ++inline uint32_t ToHost(uint32_t x) { return ToHost32(x); } ++inline uint64_t ToHost(uint64_t x) { return ToHost64(x); } ++ ++inline int8_t FromHost(int8_t x) { return x; } ++inline int16_t FromHost(int16_t x) { ++ return bit_cast(FromHost16(bit_cast(x))); ++} ++inline int32_t FromHost(int32_t x) { ++ return bit_cast(FromHost32(bit_cast(x))); ++} ++inline int64_t FromHost(int64_t x) { ++ return bit_cast(FromHost64(bit_cast(x))); ++} ++inline int8_t ToHost(int8_t x) { return x; } ++inline int16_t ToHost(int16_t x) { ++ return bit_cast(ToHost16(bit_cast(x))); ++} ++inline int32_t ToHost(int32_t x) { ++ return bit_cast(ToHost32(bit_cast(x))); ++} ++inline int64_t ToHost(int64_t x) { ++ return bit_cast(ToHost64(bit_cast(x))); ++} ++ + // Functions to do unaligned loads and stores in little-endian order. + inline uint16_t Load16(const void *p) { + return ToHost16(ABSL_INTERNAL_UNALIGNED_LOAD16(p)); +@@ -233,6 +264,36 @@ + + #endif /* ENDIAN */ + ++inline uint8_t FromHost(uint8_t x) { return x; } ++inline uint16_t FromHost(uint16_t x) { return FromHost16(x); } ++inline uint32_t FromHost(uint32_t x) { return FromHost32(x); } ++inline uint64_t FromHost(uint64_t x) { return FromHost64(x); } ++inline uint8_t ToHost(uint8_t x) { return x; } ++inline uint16_t ToHost(uint16_t x) { return ToHost16(x); } ++inline uint32_t ToHost(uint32_t x) { return ToHost32(x); } ++inline uint64_t ToHost(uint64_t x) { return ToHost64(x); } ++ ++inline int8_t FromHost(int8_t x) { return x; } ++inline int16_t FromHost(int16_t x) { ++ return bit_cast(FromHost16(bit_cast(x))); ++} ++inline int32_t FromHost(int32_t x) { ++ return bit_cast(FromHost32(bit_cast(x))); ++} ++inline int64_t FromHost(int64_t x) { ++ return bit_cast(FromHost64(bit_cast(x))); ++} ++inline int8_t ToHost(int8_t x) { return x; } ++inline int16_t ToHost(int16_t x) { ++ return bit_cast(ToHost16(bit_cast(x))); ++} ++inline int32_t ToHost(int32_t x) { ++ return bit_cast(ToHost32(bit_cast(x))); ++} ++inline int64_t ToHost(int64_t x) { ++ return bit_cast(ToHost64(bit_cast(x))); ++} ++ + // Functions to do unaligned loads and stores in big-endian order. + inline uint16_t Load16(const void *p) { + return ToHost16(ABSL_INTERNAL_UNALIGNED_LOAD16(p)); +--- a/absl/random/CMakeLists.txt ++++ b/absl/random/CMakeLists.txt +@@ -611,6 +611,7 @@ + ${ABSL_DEFAULT_LINKOPTS} + DEPS + absl::config ++ absl::endian + TESTONLY + ) + +@@ -758,6 +759,7 @@ + LINKOPTS + ${ABSL_DEFAULT_LINKOPTS} + DEPS ++ absl::endian + absl::random_internal_iostream_state_saver + absl::random_internal_randen + absl::raw_logging_internal +@@ -1119,6 +1121,7 @@ + LINKOPTS + ${ABSL_DEFAULT_LINKOPTS} + DEPS ++ absl::endian + absl::random_internal_randen_slow + gtest_main + ) +--- a/absl/random/internal/BUILD.bazel ++++ b/absl/random/internal/BUILD.bazel +@@ -124,7 +124,10 @@ + ], + copts = ABSL_DEFAULT_COPTS, + linkopts = ABSL_DEFAULT_LINKOPTS, +- deps = ["//absl/base:config"], ++ deps = [ ++ "//absl/base:config", ++ "//absl/base:endian", ++ ], + ) + + cc_library( +@@ -241,6 +244,7 @@ + deps = [ + ":iostream_state_saver", + ":randen", ++ "//absl/base:endian", + "//absl/meta:type_traits", + ], + ) +@@ -606,6 +610,7 @@ + ":platform", + ":randen_slow", + "@com_google_googletest//:gtest_main", ++ "//absl/base:endian", + ], + ) + +--- a/absl/random/internal/explicit_seed_seq.h ++++ b/absl/random/internal/explicit_seed_seq.h +@@ -23,6 +23,7 @@ + #include + + #include "absl/base/config.h" ++#include "absl/base/internal/endian.h" + + namespace absl { + ABSL_NAMESPACE_BEGIN +@@ -73,7 +74,7 @@ + template + void generate(OutIterator begin, OutIterator end) { + for (size_t index = 0; begin != end; begin++) { +- *begin = state_.empty() ? 0 : state_[index++]; ++ *begin = state_.empty() ? 0 : little_endian::FromHost32(state_[index++]); + if (index >= state_.size()) { + index = 0; + } +--- a/absl/random/internal/randen_engine.h ++++ b/absl/random/internal/randen_engine.h +@@ -23,6 +23,7 @@ + #include + #include + ++#include "absl/base/internal/endian.h" + #include "absl/meta/type_traits.h" + #include "absl/random/internal/iostream_state_saver.h" + #include "absl/random/internal/randen.h" +@@ -76,7 +77,7 @@ + impl_.Generate(state_); + } + +- return state_[next_++]; ++ return little_endian::ToHost(state_[next_++]); + } + + template +@@ -181,7 +182,8 @@ + // In the case that `elem` is `uint8_t`, it must be cast to something + // larger so that it prints as an integer rather than a character. For + // simplicity, apply the cast all circumstances. +- os << static_cast(elem) << os.fill(); ++ os << static_cast(little_endian::FromHost(elem)) ++ << os.fill(); + } + os << engine.next_; + return os; +@@ -200,7 +202,7 @@ + // necessary to read a wider type and then cast it to uint8_t. + numeric_type value; + is >> value; +- elem = static_cast(value); ++ elem = little_endian::ToHost(static_cast(value)); + } + is >> next; + if (is.fail()) { +--- a/absl/random/internal/randen_slow_test.cc ++++ b/absl/random/internal/randen_slow_test.cc +@@ -17,6 +17,7 @@ + #include + + #include "gtest/gtest.h" ++#include "absl/base/internal/endian.h" + #include "absl/random/internal/randen_traits.h" + + namespace { +@@ -56,7 +57,7 @@ + + uint64_t* id = d.state; + for (const auto& elem : kGolden) { +- EXPECT_EQ(elem, *id++); ++ EXPECT_EQ(absl::little_endian::FromHost64(elem), *id++); + } + } + diff --git a/patches/fix-hppa.diff b/patches/fix-hppa.diff new file mode 100644 index 0000000..915efff --- /dev/null +++ b/patches/fix-hppa.diff @@ -0,0 +1,26 @@ +From: John David Anglin +Subject: Fix build on hppa +Bug-Debian: https://bugs.debian.org/971768 +Reviewed-by: Benjamin Barenblat + +--- a/absl/base/internal/direct_mmap.h ++++ b/absl/base/internal/direct_mmap.h +@@ -74,6 +74,7 @@ + inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd, + off64_t offset) noexcept { + #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \ ++ (defined(__hppa__) && !defined(__LP64__)) || \ + (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \ + (defined(__PPC__) && !defined(__PPC64__)) || \ + (defined(__riscv) && __riscv_xlen == 32) || \ +--- a/absl/debugging/internal/examine_stack.cc ++++ b/absl/debugging/internal/examine_stack.cc +@@ -48,6 +48,8 @@ + return reinterpret_cast(context->uc_mcontext.pc); + #elif defined(__arm__) + return reinterpret_cast(context->uc_mcontext.arm_pc); ++#elif defined(__hppa__) ++ return reinterpret_cast(context->uc_mcontext.sc_iaoq[0]); + #elif defined(__i386__) + if (14 < ABSL_ARRAYSIZE(context->uc_mcontext.gregs)) + return reinterpret_cast(context->uc_mcontext.gregs[14]); diff --git a/patches/latomic.diff b/patches/latomic.diff new file mode 100644 index 0000000..d78c746 --- /dev/null +++ b/patches/latomic.diff @@ -0,0 +1,20 @@ +From: Benjamin Barenblat +Subject: Use libatomic if necessary +Bug-Debian: https://bugs.debian.org/973492 + +On some architectures, notably armel, Abseil needs symbols defined in +libatomic. Abseil does not currently have a well-developed system to +declare external library dependencies, so just have the linker determine +if anything needs libatomic and add the DT_NEEDED entry where necessary. + +--- a/absl/copts/AbseilConfigureCopts.cmake ++++ b/absl/copts/AbseilConfigureCopts.cmake +@@ -64,4 +64,8 @@ + set(ABSL_TEST_COPTS "") + endif() + ++list(APPEND ABSL_DEFAULT_LINKOPTS ++ "-Wl,--as-needed" "-latomic" "-Wl,--no-as-needed" ++) ++ + set(ABSL_CXX_STANDARD "${CMAKE_CXX_STANDARD}") diff --git a/patches/nan-narrowing.diff b/patches/nan-narrowing.diff new file mode 100644 index 0000000..c7ec932 --- /dev/null +++ b/patches/nan-narrowing.diff @@ -0,0 +1,25 @@ +From: Benjamin Barenblat +Subject: Avoid libgcc -NaN narrowing bug +Forwarded: yes +Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/1bae23e32ba1f1af7c7d1488a69a351ec96dc98d + +When testing -NaN parsing, avoid narrowing -NaN from double to float. This +avoids a bug in libgcc (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98251). + +The author works at Google. Upstream applied this patch as Piper revision +347654751 and exported it to GitHub; the Applied-Upstream URL above points to +the exported commit. + +--- a/absl/strings/charconv_test.cc ++++ b/absl/strings/charconv_test.cc +@@ -653,7 +653,9 @@ TEST(FromChars, NaNFloats) { + negative_from_chars_float); + EXPECT_TRUE(std::signbit(negative_from_chars_float)); + EXPECT_FALSE(Identical(negative_from_chars_float, from_chars_float)); +- from_chars_float = std::copysign(from_chars_float, -1.0); ++ // Use the (float, float) overload of std::copysign to prevent narrowing; ++ // see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98251. ++ from_chars_float = std::copysign(from_chars_float, -1.0f); + EXPECT_TRUE(Identical(negative_from_chars_float, from_chars_float)); + } + } diff --git a/patches/ppc-float-conversion.diff b/patches/ppc-float-conversion.diff new file mode 100644 index 0000000..f0ff959 --- /dev/null +++ b/patches/ppc-float-conversion.diff @@ -0,0 +1,268 @@ +From: Samuel Benzaquen +Subject: Fix float conversion for PPC. +Origin: backport, https://github.com/abseil/abseil-cpp/commit/c36d825d9a5443f81d2656685ae021d6326da90c + +In PPC `long double` is a double-double representation which behaves weirdly +wrt numeric_limits. Don't take `long double` into account when we are not +handling `long double` natively anyway. + +Fix the convert test to always run the conversion even if we are not going to +compare against libc's printf result. This allows exercising the code itself to +make sure we don't trigger assertions or UB found by sanitizers. + +The author works at Google. Upstream applied this patch as Piper revision +355857729 and exported it to GitHub; the Applied-Upstream URL above points to +the exported commit. + +--- a/absl/strings/internal/str_format/convert_test.cc ++++ b/absl/strings/internal/str_format/convert_test.cc +@@ -540,7 +540,8 @@ + } + + template +-void TestWithMultipleFormatsHelper(const std::vector &floats) { ++void TestWithMultipleFormatsHelper(const std::vector &floats, ++ const std::set &skip_verify) { + const NativePrintfTraits &native_traits = VerifyNativeImplementation(); + // Reserve the space to ensure we don't allocate memory in the output itself. + std::string str_format_result; +@@ -588,7 +589,16 @@ + AppendPack(&str_format_result, format, absl::MakeSpan(args)); + } + +- if (string_printf_result != str_format_result) { ++#ifdef _MSC_VER ++ // MSVC has a different rounding policy than us so we can't test our ++ // implementation against the native one there. ++ continue; ++#elif defined(__APPLE__) ++ // Apple formats NaN differently (+nan) vs. (nan) ++ if (std::isnan(d)) continue; ++#endif ++ if (string_printf_result != str_format_result && ++ skip_verify.find(d) == skip_verify.end()) { + // We use ASSERT_EQ here because failures are usually correlated and a + // bug would print way too many failed expectations causing the test + // to time out. +@@ -602,12 +612,6 @@ + } + + TEST_F(FormatConvertTest, Float) { +-#ifdef _MSC_VER +- // MSVC has a different rounding policy than us so we can't test our +- // implementation against the native one there. +- return; +-#endif // _MSC_VER +- + std::vector floats = {0.0f, + -0.0f, + .9999999f, +@@ -621,7 +625,8 @@ + std::numeric_limits::epsilon(), + std::numeric_limits::epsilon() + 1.0f, + std::numeric_limits::infinity(), +- -std::numeric_limits::infinity()}; ++ -std::numeric_limits::infinity(), ++ std::nanf("")}; + + // Some regression tests. + floats.push_back(0.999999989f); +@@ -650,21 +655,14 @@ + std::sort(floats.begin(), floats.end()); + floats.erase(std::unique(floats.begin(), floats.end()), floats.end()); + +-#ifndef __APPLE__ +- // Apple formats NaN differently (+nan) vs. (nan) +- floats.push_back(std::nan("")); +-#endif +- +- TestWithMultipleFormatsHelper(floats); ++ TestWithMultipleFormatsHelper(floats, {}); + } + + TEST_F(FormatConvertTest, Double) { +-#ifdef _MSC_VER +- // MSVC has a different rounding policy than us so we can't test our +- // implementation against the native one there. +- return; +-#endif // _MSC_VER +- ++ // For values that we know won't match the standard library implementation we ++ // skip verification, but still run the algorithm to catch asserts/sanitizer ++ // bugs. ++ std::set skip_verify; + std::vector doubles = {0.0, + -0.0, + .99999999999999, +@@ -678,7 +676,8 @@ + std::numeric_limits::epsilon(), + std::numeric_limits::epsilon() + 1, + std::numeric_limits::infinity(), +- -std::numeric_limits::infinity()}; ++ -std::numeric_limits::infinity(), ++ std::nan("")}; + + // Some regression tests. + doubles.push_back(0.99999999999999989); +@@ -708,33 +707,29 @@ + "5084551339423045832369032229481658085593321233482747978262041447231" + "68738177180919299881250404026184124858368.000000"; + +- if (!gcc_bug_22142) { +- for (int exp = -300; exp <= 300; ++exp) { +- const double all_ones_mantissa = 0x1fffffffffffff; +- doubles.push_back(std::ldexp(all_ones_mantissa, exp)); ++ for (int exp = -300; exp <= 300; ++exp) { ++ const double all_ones_mantissa = 0x1fffffffffffff; ++ doubles.push_back(std::ldexp(all_ones_mantissa, exp)); ++ if (gcc_bug_22142) { ++ skip_verify.insert(doubles.back()); + } + } + + if (gcc_bug_22142) { +- for (auto &d : doubles) { +- using L = std::numeric_limits; +- double d2 = std::abs(d); +- if (d2 == L::max() || d2 == L::min() || d2 == L::denorm_min()) { +- d = 0; +- } +- } ++ using L = std::numeric_limits; ++ skip_verify.insert(L::max()); ++ skip_verify.insert(L::min()); // NOLINT ++ skip_verify.insert(L::denorm_min()); ++ skip_verify.insert(-L::max()); ++ skip_verify.insert(-L::min()); // NOLINT ++ skip_verify.insert(-L::denorm_min()); + } + + // Remove duplicates to speed up the logic below. + std::sort(doubles.begin(), doubles.end()); + doubles.erase(std::unique(doubles.begin(), doubles.end()), doubles.end()); + +-#ifndef __APPLE__ +- // Apple formats NaN differently (+nan) vs. (nan) +- doubles.push_back(std::nan("")); +-#endif +- +- TestWithMultipleFormatsHelper(doubles); ++ TestWithMultipleFormatsHelper(doubles, skip_verify); + } + + TEST_F(FormatConvertTest, DoubleRound) { +@@ -1055,11 +1050,6 @@ + } + + TEST_F(FormatConvertTest, LongDouble) { +-#ifdef _MSC_VER +- // MSVC has a different rounding policy than us so we can't test our +- // implementation against the native one there. +- return; +-#endif // _MSC_VER + const NativePrintfTraits &native_traits = VerifyNativeImplementation(); + const char *const kFormats[] = {"%", "%.3", "%8.5", "%9", "%.5000", + "%.60", "%+", "% ", "%-10"}; +@@ -1120,10 +1110,18 @@ + for (auto d : doubles) { + FormatArgImpl arg(d); + UntypedFormatSpecImpl format(fmt_str); ++ std::string result = FormatPack(format, {&arg, 1}); ++ ++#ifdef _MSC_VER ++ // MSVC has a different rounding policy than us so we can't test our ++ // implementation against the native one there. ++ continue; ++#endif // _MSC_VER ++ + // We use ASSERT_EQ here because failures are usually correlated and a + // bug would print way too many failed expectations causing the test to + // time out. +- ASSERT_EQ(StrPrint(fmt_str.c_str(), d), FormatPack(format, {&arg, 1})) ++ ASSERT_EQ(StrPrint(fmt_str.c_str(), d), result) + << fmt_str << " " << StrPrint("%.18Lg", d) << " " + << StrPrint("%La", d) << " " << StrPrint("%.1080Lf", d); + } +--- a/absl/strings/internal/str_format/float_conversion.cc ++++ b/absl/strings/internal/str_format/float_conversion.cc +@@ -98,12 +98,22 @@ + return next_carry % divisor; + } + ++constexpr bool IsDoubleDouble() { ++ // This is the `double-double` representation of `long double`. ++ // We do not handle it natively. Fallback to snprintf. ++ return std::numeric_limits::digits == ++ 2 * std::numeric_limits::digits; ++} ++ ++using MaxFloatType = ++ typename std::conditional::type; ++ + // Generates the decimal representation for an integer of the form `v * 2^exp`, + // where `v` and `exp` are both positive integers. + // It generates the digits from the left (ie the most significant digit first) + // to allow for direct printing into the sink. + // +-// Requires `0 <= exp` and `exp <= numeric_limits::max_exponent`. ++// Requires `0 <= exp` and `exp <= numeric_limits::max_exponent`. + class BinaryToDecimal { + static constexpr int ChunksNeeded(int exp) { + // We will left shift a uint128 by `exp` bits, so we need `128+exp` total +@@ -118,10 +128,10 @@ + static void RunConversion(uint128 v, int exp, + absl::FunctionRef f) { + assert(exp > 0); +- assert(exp <= std::numeric_limits::max_exponent); ++ assert(exp <= std::numeric_limits::max_exponent); + static_assert( + StackArray::kMaxCapacity >= +- ChunksNeeded(std::numeric_limits::max_exponent), ++ ChunksNeeded(std::numeric_limits::max_exponent), + ""); + + StackArray::RunWithCapacity( +@@ -218,14 +228,14 @@ + + // Converts a value of the form `x * 2^-exp` into a sequence of decimal digits. + // Requires `-exp < 0` and +-// `-exp >= limits::min_exponent - limits::digits`. ++// `-exp >= limits::min_exponent - limits::digits`. + class FractionalDigitGenerator { + public: + // Run the conversion for `v * 2^exp` and call `f(generator)`. + // This function will allocate enough stack space to perform the conversion. + static void RunConversion( + uint128 v, int exp, absl::FunctionRef f) { +- using Limits = std::numeric_limits; ++ using Limits = std::numeric_limits; + assert(-exp < 0); + assert(-exp >= Limits::min_exponent - 128); + static_assert(StackArray::kMaxCapacity >= +@@ -858,10 +868,10 @@ + // This buffer holds the "0x1.ab1de3" portion of "0x1.ab1de3pe+2". Compute the + // size with long double which is the largest of the floats. + constexpr size_t kBufSizeForHexFloatRepr = +- 2 // 0x +- + std::numeric_limits::digits / 4 // number of hex digits +- + 1 // round up +- + 1; // "." (dot) ++ 2 // 0x ++ + std::numeric_limits::digits / 4 // number of hex digits ++ + 1 // round up ++ + 1; // "." (dot) + char digits_buffer[kBufSizeForHexFloatRepr]; + char *digits_iter = digits_buffer; + const char *const digits = +@@ -1380,10 +1390,7 @@ + + bool ConvertFloatImpl(long double v, const FormatConversionSpecImpl &conv, + FormatSinkImpl *sink) { +- if (std::numeric_limits::digits == +- 2 * std::numeric_limits::digits) { +- // This is the `double-double` representation of `long double`. +- // We do not handle it natively. Fallback to snprintf. ++ if (IsDoubleDouble()) { + return FallbackToSnprintf(v, conv, sink); + } + diff --git a/patches/series b/patches/series new file mode 100644 index 0000000..ceceb69 --- /dev/null +++ b/patches/series @@ -0,0 +1,9 @@ +configure.diff +fix-hppa.diff +std-hash.diff +latomic.diff +cpu-frequency.diff +nan-narrowing.diff +endian-hash.diff +endian-random.diff +ppc-float-conversion.diff diff --git a/patches/std-hash.diff b/patches/std-hash.diff new file mode 100644 index 0000000..5209674 --- /dev/null +++ b/patches/std-hash.diff @@ -0,0 +1,46 @@ +From: Benjamin Barenblat +Subject: Work around broken std::hash on s390x +Forwarded: no +Bug-Debian: https://bugs.debian.org/977638 + +On s390x, std::hash hashes large classes of data to the same value, which +violates assumptions made by the Abseil tests. #ifdef out the test code that +depends on those assumptions. + +--- a/absl/hash/hash_test.cc ++++ b/absl/hash/hash_test.cc +@@ -358,6 +358,8 @@ + TEST(HashValueTest, StdBitset) { + EXPECT_TRUE((is_hashable>::value)); + ++ // The following assertions fail on s390x (https://bugs.debian.org/977638). ++#ifndef __s390x__ + EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly( + {std::bitset<2>("00"), std::bitset<2>("01"), std::bitset<2>("10"), + std::bitset<2>("11")})); +@@ -379,6 +381,7 @@ + std::bitset(bit_strings[3].c_str()), + std::bitset(bit_strings[4].c_str()), + std::bitset(bit_strings[5].c_str())})); ++#endif + } // namespace + + template +@@ -400,10 +403,15 @@ + } + + REGISTER_TYPED_TEST_CASE_P(HashValueSequenceTest, BasicUsage); ++// std::vector tests fail on s390x, so exclude them. See ++// https://bugs.debian.org/977638. + using IntSequenceTypes = + testing::Types, std::forward_list, std::list, +- std::vector, std::vector, std::set, +- std::multiset>; ++ std::vector, ++#ifndef __s390x__ ++ std::vector, ++#endif ++ std::set, std::multiset>; + INSTANTIATE_TYPED_TEST_CASE_P(My, HashValueSequenceTest, IntSequenceTypes); + + // Private type that only supports AbslHashValue to make sure our chosen hash diff --git a/rules b/rules new file mode 100755 index 0000000..03e1a00 --- /dev/null +++ b/rules @@ -0,0 +1,52 @@ +#!/usr/bin/make -f +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow reproducible=+fixfilepath + +# Unit tests aren't working on all platforms yet. +ifeq ($(shell dpkg-architecture -qDEB_HOST_ARCH),amd64) +ABSL_RUN_TESTS=ON +else +ABSL_RUN_TESTS=OFF +endif + +%: + dh $@ + +override_dh_auto_clean: + $(RM) -r $(CURDIR)/static + $(RM) -r $(CURDIR)/shared + +override_dh_auto_configure: + dh_auto_configure -Bstatic -- -DCMAKE_CXX_STANDARD=14 -DBUILD_SHARED_LIBS=OFF +ifeq ($(ABSL_RUN_TESTS),ON) + dh_auto_configure -Bshared -- -DCMAKE_CXX_STANDARD=14 -DBUILD_SHARED_LIBS=ON -DABSL_RUN_TESTS=ON -DABSL_USE_GOOGLETEST_HEAD=OFF +else + dh_auto_configure -Bshared -- -DCMAKE_CXX_STANDARD=14 -DBUILD_SHARED_LIBS=ON +endif + +override_dh_auto_build: + dh_auto_build -Bstatic + dh_auto_build -Bshared + +ifeq ($(ABSL_RUN_TESTS),ON) +override_dh_auto_test: + dh_auto_test -Bshared +endif + +override_dh_auto_install: + dh_auto_install -Bstatic + dh_auto_install -Bshared + find debian/tmp -type d -empty -delete diff --git a/source/format b/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/tests/cmake b/tests/cmake new file mode 100755 index 0000000..1eb04de --- /dev/null +++ b/tests/cmake @@ -0,0 +1,45 @@ +#!/bin/sh -eu +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +readonly TMP="$(mktemp -d)" +trap "rm -rf \"$TMP\"" EXIT +cd "$TMP" + +cat >test.cc < + +int main(int argc, char* argv[]) { + int n; + if (!absl::SimpleAtoi(argv[1], &n)) { + return 1; + } + return n; +} +EOF + +cat >CMakeLists.txt <= 3.5), g++, make diff --git a/tests/smoke b/tests/smoke new file mode 100755 index 0000000..7c4b66f --- /dev/null +++ b/tests/smoke @@ -0,0 +1,37 @@ +#!/bin/sh -eu +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +readonly TMP="$(mktemp -d)" +trap "rm -rf \"$TMP\"" EXIT +cd "$TMP" + +cat >smoke.cc < +#include + +#include + +namespace { + +TEST(AbseilTest, StrJoinWorks) { + std::vector v = {"foo", "bar", "baz"}; + EXPECT_EQ(absl::StrJoin(v, "-"), "foo-bar-baz"); +} + +} // namespace +EOF + +g++ -o smoke smoke.cc -labsl_strings -lgtest -lgtest_main -pthread +./smoke diff --git a/watch b/watch new file mode 100644 index 0000000..4337b53 --- /dev/null +++ b/watch @@ -0,0 +1,17 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +version=4 +opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/abseil-$1\.tar\.gz/ \ + https://github.com/abseil/abseil-cpp/releases .*/v?(\d\S+)\.tar\.gz -- 2.30.2